import { reactive } from "vue";
import { getUserByPositionApi } from "@/api/managementCenter/departmentPersonnel";
export const searchItemList: Array<SuperSearch.SearchItem> = [
  {
    type: "input",
    label: "运单号",
    keyName: "waybillNums",
    placeholder: "支持批量(空格/逗号隔开)"
  },
  {
    type: "input",
    label: "客户名称",
    keyName: "customerName"
  },
  {
    type: "input",
    label: "费用名称",
    keyName: "costName"
  },
  reactive<SuperSearch.SearchItem>({
    type: "select",
    label: "追加人",
    keyName: "createBy",
    optionsRequest: getUserByPositionApi,
    optReqParams: { status: 1, pageNum: 1, pageSize: 9999999, total: 0 },
    optReqCb: (res: Base.GeneraDataType, row: SuperSearch.SearchItem) => {
      const { code, data } = res;
      if (code === 200) {
        row.options = data.records || [];
      }
    },
    optConfig: {
      label: "username",
      value: "id"
    },
    options: []
  })
];

export const tableColumn: Array<SuperTable.TableCoulmnItem | SuperTable.NestTableColumnItem> = [
  {
    field: "waybillNum",
    title: "运单号",
    minWidth: "140"
  },
  {
    field: "operation",
    title: "操作内容",
    minWidth: "160"
  },
  {
    field: "operationBefore",
    title: "操作前",
    minWidth: "160"
  },
  {
    field: "operationAfter",
    title: "操作后",
    minWidth: "160"
  },
  {
    field: "updateName",
    title: "操作人",
    minWidth: "90"
  },
  {
    field: "updateTime",
    title: "操作时间",
    minWidth: "135",
    formatter: "formatDate"
  }
];
